package com.account.Interceptor;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 拦截器配置类
 * Created with IntelliJ IDEA.
 * User: lixiao
 * Created Date: 2020/4/7 22:21
 */
@SpringBootConfiguration
public class LoginVerificationAdapter implements WebMvcConfigurer {

    @Resource(name = "loginVerification")
    LoginVerification loginVerification;

@Resource(name = "visitRecord")
    VisitRecord visitRecord;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /**
         * 使用两个拦截器
         */
        registry.addInterceptor(visitRecord).addPathPatterns("/k/**");
        registry.addInterceptor(loginVerification).addPathPatterns("/accoun/**").excludePathPatterns("/login/**");
    }
}